package com.hnkywl.sts.action.cwgl;

import com.hnkywl.sts.entity.cwgl.kmys.Rjbys;
import com.hnkywl.sts.service.cwgl.RjbysService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by ccr on 2014/7/9.
 */
@Namespace("/cwgl/kmys")
public class RjbysAction extends SimpleActionSupport {
    private String gs;
    private Rjbys rjbys;
    private RjbysService rjbysService;

    @Action("save_rjbys")
    public void save_rjbys(){
        try{
            rjbysService.save(rjbys);
            renderJson("{\"statusCode\":200}");
        } catch (Exception e) {
            renderJson("{\"statusCode\":300,\"message\":\""+e.getMessage()+"\"}");
        }
    }

    @Action("rjbysList")
    public void rjbysList(){
        renderJson(rjbysService.rjbysList(gs));
    }

    public String getGs() {
        return gs;
    }

    public void setGs(String gs) {
        this.gs = gs;
    }

    public Rjbys getRjbys() {
        return rjbys;
    }

    public void setRjbys(Rjbys rjbys) {
        this.rjbys = rjbys;
    }

    @Autowired
    public void setRjbysService(RjbysService rjbysService) {
        this.rjbysService = rjbysService;
    }
}
